/*
 * @ProjectName: 编程学习
 * @Copyright:   2018 HangZhou xiazhaoyang Dev, Ltd. All Right Reserved.
 * @address:     http://xiazhaoyang.tech
 * @date:        2018/9/17 22:29
 * @email:       xiazhaoyang@live.com
 * @description: 本内容仅限于编程技术学习使用，转发请注明出处.
 */
package com.capsule.chapter.extend;

/**
 * <p>
 *
 * </p>
 *
 * @author xiazhaoyang
 * @version V1.0
 * @date 2018/9/17 22:29
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人} 2018/9/17
 * @modify reason: {方法名}:{原因}
 * ...
 */
public class B extends A{

    public B() {
        System.out.println("Class B");
    }
    {
        //方法快中无论什么方法都可以执行
        System.out.println("{} B");
        isStatic();
        notStatic();
    }
    static{
        //静态方法块中只能执行静态方法
        System.out.println("static B");
        //notStatic(); 报错
        isStatic();//不报错，使用的是静态方法
    }

    public static void isStatic(){
        System.out.println("is static method B");
    }

    public void notStatic(){
        System.out.println("not static method B");
    }

    public static void overrideMe(){
        overrideMeStatic("static method B");//父类静态方法
        System.out.println("overrideMe B");
    }

    public static void main(String[] args) {
        B b = new B();
        b.overrideMe();
        B.overrideMe();
        //static A
        //overrideMeStatic A - static
        //static B
        //is static method B
        //{} A
        //overrideMe A - {}
        //Class A
        //{} B
        //is static method B
        //not static method B
        //Class B
        //overrideMeStatic A - static method B
        //overrideMe B
        //overrideMeStatic A - static method B
        //overrideMe B
    }

}